import axios from "axios";

/* 高德 */
export const AutonaviApi = (data) =>
  axios({
    url:
      "https://restapi.amap.com/v3/geocode/geo?key=2f557a94eefda2b320ed734c599666d0&address=" +
      data,
    method: "get",
  });
export const AutonaviAdress = (data) =>
  axios({
    // https://restapi.amap.com/v3/geocode/regeo?output=xml&location=116.310003,39.991957&key=2f557a94eefda2b320ed734c599666d0&radius=1000&extensions=all
    url: `https://restapi.amap.com/v3/geocode/regeo?location=${data}&key=2f557a94eefda2b320ed734c599666d0`,
    method: "get",
  });
// /* 天气 */https://restapi.amap.com/v3/weather/weatherInfo?city=110101&key=<用户key>
export const weatherApi = (data) =>
  axios({
    url: `https://restapi.amap.com/v3/weather/weatherInfo?city=${data}&key=2f557a94eefda2b320ed734c599666d0`,
    method: "get",
  });
// res.data.geocodes[0].location
/* 天地图 */
// 'http://api.tianditu.gov.cn/geocoder?ds={"keyWord":"' + pro.value + adr.value + '"}&tk=0a19ac381c59eb4b32f273566fd82107',
export const TianDiTuApi = (data) =>
  axios({
    url:
      'http://api.tianditu.gov.cn/geocoder?ds={"keyWord":"' +
      data +
      '"}&tk=0a19ac381c59eb4b32f273566fd82107',
    method: "get",
  });
export const Address = () =>
  axios({
    url: "https://restapi.amap.com/v3/ip?key=2fb825db9f28f7bfefba427ee21d23dd",
    method: "get",
  });
